<?php

//__autoload()函数在PHP7.2以后就不支持了。
//function __autoload($className){
//    require './{$className}.php';
//}

spl_autoload_register(function ($className){
    require "./{$className}.php";
});

$book = new Book();
$book->setName("天龙八部");
echo $book->getName();

$phone = new Phone();
$phone->setName("苹果11");
echo $phone->getName();